package com.project.ryudo.SessionBean;

import java.util.List;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 * Session Bean implementation class StaffBean
 */
@Stateless
@LocalBean
public class StaffBean implements StaffBeanRemote {

    /**
     * Default constructor. 
     */
	@PersistenceContext
	EntityManager em;
    public StaffBean() {
        // TODO Auto-generated constructor stub
    }
    
    @Override
	public List LoginStaffIn(String email, String password) {
		Query query = em.createQuery("select staff from Staff staff where staff.email = :email and staff.password = :password");
		query.setParameter("email", email);
		query.setParameter("password", password);
		List result = query.getResultList();
		return result;
	}

	@Override
	public List requestedStaff(String email) {
		Query query = em.createQuery("select stf from Staff stf where stf.email = :email");
		query.setParameter("email", email);
		List result = query.getResultList();
		return result;
	}

}
